using System;
using System.ComponentModel;
using Primitive.Mvvm.Framework.Interfaces;

namespace Primitive.Mvvm.Framework.Implementations
{
    public class Mediator : IMediator, IDisposable
    {
        public event PropertyChangedEventHandler PropertyChanged;
        public void Subscribe(IViewModel subscriber)
        {
            PropertyChanged += subscriber.NotifyViewModelChanged;
        }

        public void Unsubscribe(IViewModel subscriber)
        {
            PropertyChanged -= subscriber.NotifyViewModelChanged;
        }

        public void NotifyAll(object sender, PropertyChangedEventArgs pce)
        {
            if (PropertyChanged != null)
                PropertyChanged(sender, pce);
        }

        public void Dispose()
        {
            
        }
    }
}